<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>

        // 1 创建请求   xmlhttp请求
        const xhr = new XMLHttpRequest();
        // 2 选择请求方式和路径
        xhr.open('get', '../data/1user.json', true);
        // 3 发送
        xhr.send();
        // 4 等待
        xhr.onreadystatechange = function () {    //

            // 判断
            if (this.readyState === 4 && this.status === 200) {
                let data = this.responseText;
                data = JSON.parse(data);
                console.log(data);
                // 遍历

            }
        }




    </script>

</body>

</html>